package com.authine.cloudpivot.ext.service;

import com.alibaba.cola.dto.SingleResponse;

import com.authine.cloudpivot.ext.dto.kingDee.request.KingDeeOrderGoodsReceived;
import com.authine.cloudpivot.ext.dto.kingDee.request.KingDeeReturnGeneration;
import com.authine.cloudpivot.ext.dto.voucher.Voucher;
import com.authine.cloudpivot.ext.kingdee.work.OrderWork;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;

import java.util.List;


/**
 * @Author: liwei
 * @DateTime: 2021/7/6
 * @Description: 订单部分生成凭证服务
 */
@Slf4j
public class OrderVoucherService {

    private OrderWork orderService = new OrderWork();


    /**
     * 收货生成凭证
     * 2.1外购入库和3.1销售出库
     *
     * @param ogreList
     */
    public SingleResponse<List<Voucher>> receiptGoodsVoucher( List<KingDeeOrderGoodsReceived> ogreList) {
        Assert.isTrue(!CollectionUtils.isEmpty(ogreList), "收货生成凭证 入参数据为空");

        return orderService.receiptGoodsVoucher(ogreList);
    }


    /**
     * 退货生成凭证
     * 退平台：3.2销售退货、退供应商：2.2外购退货和3.2销售退货
     * 转采：销售退货
     * @param kingDeeReturnGeneration
     * @return
     */
    public SingleResponse returnGoodsVoucher( KingDeeReturnGeneration kingDeeReturnGeneration) {
        Assert.notNull(kingDeeReturnGeneration, "退货生成凭证 入参数据为空");

        return orderService.returnGoodsVoucher(kingDeeReturnGeneration);
    }





}
